<?php
// No directAcces
defined( '_AppBackMiage' ) or die( 'Restricted access' );
if(isAdministrateur ()){
    include_once (DS."backoffice/include/header.php");
    include_once( DS."backoffice/include/toppanel_portail.php");
    ?>
    <div id="wrapper">
            <div id="content">
            <div id="rightnow">
                             <?php
                    $title = "Cat&eacute;gories";
                    $add = '<a href="' . URL . 'index.php?m=admin_portailcategorie_add" class="add">Ajouter une cat&eacute;gorie</a>';
                    ?>

                    <h3 class="reallynow">
                        <span>Liste des <?php echo $title; ?></span>
                        <?php echo $add;?>
                        <br />
                    </h3>
                <p class="youhave">
                <?php

                            $listeCategorie = Categorie::getListCategory();
                            //var_dump($listeDomaine);
                            ?>
                <table>
                    <thead>
                        <tr>
                            <th>
                                Cat&eacute;gorie
                            </th>
                            <th>
                                Description
                            </th>
                            <th>
                                Action
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                                    <?php
                    foreach($listeCategorie as $categorie){
                        $editURL = URL."/index.php?m=admin_portailcategorie_edit&uid=".$categorie->IdCategorie;
                                            $viewURL = URL."/index.php?m=admin_portailcategorie_view&uid=".$categorie->IdCategorie;
                        ?>
                        <tr>
                            <td>
                                <label for="categorie"><?php echo $categorie->NomCategorie;?></label>
                            </td>
                            <td>
                                <label for="categorie"><?php echo $categorie->DescriptionCategorie;?></label>
                            </td>
                            <td>
                                <a href="<?php echo $editURL; ?>">
                                    <img src="<?php echo STYLEBK; ?>img/icons/user_edit.png" title="Edit cat&eacute;gorie" width="16" height="16" />
                                </a>
                                <a href="<?php echo $viewURL; ?>">
                                    <img src="<?php echo STYLEBK; ?>img/icons/user.png" title="Show cat&eacute;gorie" width="16" height="16" />
                                </a>
                            </td>
                        </tr>
                    <?php
                    }
                    ?>
                     </tbody>
                    </table>
                </p>
            </div>
        </div>

    <?php
    include_once (DS."backoffice/include/sidebar.php");
    include_once (DS."backoffice/include/footer.php");
}
else
{
    redirectTo(URLBACK);
}
?>